package LC;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

/**
 * @ClassName PrintMinNumber
 * @Description: TODO
 * @Author hl
 * @Date 2020/6/7
 * @Version V1.0
 **/
public class PrintMinNumber {

    public String PrintMinNumber(int [] numbers) {
        ArrayList<Integer> list=new ArrayList<>();
        for(int i=0;i<numbers.length;i++){
            list.add(numbers[i]);
        }
        Collections.sort(list, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                String s1=""+o1+o2;
                String s2=""+o2+o1;
                return  s1.compareTo(s2);
            }
        });
        String result="";
        for(int i=0;i<list.size();i++){
            result+=list.get(i);
        }
        return  result;
    }

}
